It's a simple protocol originally designed to retrieve static web pages.
It is used to communicate and transfer data over the web. It defines how messages are formatted and transmitted by browser.
It is connection-less (because once a single HTTP request is serviced, the connection is closed and not reused), but uses TCP as its transport mechanism.
TCP Port 80 or 8080
HTTP functions as a request–response protocol in the client–server computing model.
A client (browser) sends an HTTP request to the server; then the server returns a status line, such as "HTTP/1.1 200 OK", and a message of its own.
The response contains status information about the request and may also contain the requested content.
HTTP Versions: 1.1,2.0,3.0
HTTPS (Hypertext Transfer Protocol Secure) , TCP Port 443
In HTTPS HTTP is encrypted using TLS (Transport Layer Security) or SSL (Secure Sockets Layer). The protocol is therefore also referred to as HTTP over TLS, or HTTP over SSL.
All HTTP messages contain:
First line of the HTTP requests has three elements
The typical HTTP request consists of three items:
Every HTTP response must contain a status-code indicating the the result of the request. There are five groups of status codes based upon the first digit of the code:
Common HTTP status codes include:
HTTP defines a set of request methods to indicate the desired action to be performed for a given resource.
GET /index.html?param=value HTTP/1.0
POST /test/demo_form.php HTTP/1.1
Host: w3schools.com
name1=value1&name2=value2
PUT - send data to a server to create/update a resource
Calling the same PUT request multiple times will always produce the same result. In contrast, calling a POST request repeatedly have side effects of creating the same resource multiple times.
HEAD - almost identical to GET, but without the response body.
They are useful for checking what a GET request will return before actually making a GET request - like before downloading a large file or response body.
DELETE - deletes the specified resource.
PATCH - applies partial modifications to a resource
TRACE - used for diagnostic purposes
OPTIONS - asks the server to report HTTP methods are available.
Most common methods are GET and POST.
The uniform resource locator (URL) is a unique ID for every web resource for which a resource can be retrieved.
The basic syntax of the URL is:
protocol://hostname[:port]/ [/path/] file [?param=value]
The port number is optional and only necessary if the port is different from the default port used by the specified protocol
URI stands for uniform resource identifier and URL stands for uniform resource locator.
A URI is an identifier of a specific resource. Like a page, or book, or a document.
A URL is special type of identifier that also tells you how to access it, such as HTTPs, FTP, etc.
URI's must start with a scheme (e.g. file, http, ftp)
A scheme may or may not be associated with a protocol.
For instance the schemes 'http' and 'ftp' are clearly associated with the HTTP and FTP protocols, whereas the 'file' scheme is not associated with any protocol.